package com.gticket.customerbackend.service.impl;

import com.gticket.customerbackend.mapper.MovieScheduleMapper;
import com.gticket.customerbackend.pojo.CinemaActualSeats;
import com.gticket.customerbackend.pojo.CinemaCode;
import com.gticket.customerbackend.pojo.Movie;
import com.gticket.customerbackend.service.MovieScheduleService;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author 李浩楠
 * @date 2019/11/23 下午2:24
 */
@Service
@Data
@Transactional
public class MovieScheduleServiceImpl implements MovieScheduleService {
    @Autowired
    private MovieScheduleMapper movieScheduleMapper;

    @Override
    public List<Movie> getAllMovies(CinemaCode cinemaCode) {
        return movieScheduleMapper.getAllMovies(cinemaCode);
    }

    @Override
    public boolean insertNewMovie(CinemaCode cinemaCode, String movie_name, String movie_englishname, String moive_act, String movie_descr, String movie_detail, String movie_type, String movie_country, int movie_time, String movie_date, BigDecimal movie_price) {
        return movieScheduleMapper.insertNewMovie(cinemaCode,movie_name,movie_englishname,moive_act,movie_descr,movie_detail,movie_type,movie_country,movie_time,movie_date,movie_price);
    }

    @Override
    public List<Movie> getScheduledMovieByDate(CinemaCode cinemaCode, int cinema_id, int ch_id, String fs_date) {
        return movieScheduleMapper.getScheduledMovieByDate(cinemaCode,cinema_id,ch_id,fs_date);
    }

    @Override
    public Movie getMovieByMovieId(CinemaCode cinemaCode, int movie_id) {
        return movieScheduleMapper.getMovieByMovieId(cinemaCode,movie_id);
    }

    @Override
    public int getMovieIdByName(CinemaCode cinemaCode, String movie_name) {
        return movieScheduleMapper.getMovieIdByName(cinemaCode, movie_name);
    }

    @Override
    public CinemaActualSeats getTempSeats(CinemaCode cinemaCode, int cinema_id, int ch_id) {
        return movieScheduleMapper.getTempSeats(cinemaCode,cinema_id,ch_id);
    }

    @Override
    public boolean createActualSeats(CinemaCode cinemaCode, int cinema_id, int ch_id, String row_1, String row_2, String row_3, String row_4, String row_5, String row_6, String row_7, String row_8, String row_9, String row_10, String row_11, String row_12, String row_13, String row_14, String row_15, int stock) {
        return movieScheduleMapper.createActualSeats(cinemaCode,cinema_id,ch_id,row_1,row_2,row_3,row_4,row_5,row_6,row_7,row_8,row_9,row_10,row_11,row_12,row_13,row_14,row_15,stock);
    }

    @Override
    public int last_id() {
        return movieScheduleMapper.last_id();
    }

    @Override
    public boolean createNewMovieSchedule(CinemaCode cinemaCode, int cinema_id, int ch_id, int movie_id, int as_id, String start_time, String end_time, String fs_date,String movie_version,BigDecimal movie_realprice) {
        return movieScheduleMapper.createNewMovieSchedule(cinemaCode,cinema_id,ch_id,movie_id,as_id,start_time,end_time,fs_date,movie_version,movie_realprice);
    }

    @Override
    public void updateMovieScheduleFlag(CinemaCode cinemaCode, int fs_id) {
        movieScheduleMapper.updateMovieScheduleFlag(cinemaCode,fs_id);
    }
}
